﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Blog.Entity.Domain;

namespace Blog.EntityFrameWork.EntityFramework.Repositories
{
    public interface IBlogRepositoryBase<TEntity, TPrimaryKey> where TEntity : class, IEntity<TPrimaryKey>
    {
        Task<TPrimaryKey> CreateAndGetIdAsync(TEntity entity);

        Task<TEntity> FirstOrDefultAsync(Expression<Func<TEntity, bool>> expression);

        IQueryable<TEntity> GetAll();

        Task<List<TEntity>> GetAllListAsync();

        IQueryable<TEntity> Query(Expression<Func<TEntity, bool>> expression);

        Task Remove(Expression<Func<TEntity, bool>> expression);

        Task Remove(TEntity entity);

        Task<TEntity> UpdateAsync(TEntity entity);

        Task<TEntity> UpdateAsync(TPrimaryKey key, Func<TEntity, Task> updateAction);

    }
}